package request

// 创建书籍章节
type CreateChapter struct {
	NovelID uint   `json:"novel_id" json:"novel_id" binding:"required"`
	Name    string `json:"name" json:"name" binding:"required"`
	Content string `json:"content" json:"content" binding:"required"`
}

// 自定义错误信息
func (c CreateChapter) GetMessages() ValidatorMessages {
	return ValidatorMessages{
		"novel_id.required": "书籍ID不能为空",
		"name.required":     "章节名字不能为空",
		"content.required":  "章节内容不能为空",
	}
}

// 修改书籍章节
type UpdateChapter struct {
	NovelID uint   `json:"novel_id" json:"novel_id" binding:"required"`
	Name    string `json:"name" json:"name" binding:"required"`
	Content string `json:"content" json:"content" binding:"required"`
}

func (c UpdateChapter) GetMessages() ValidatorMessages {
	return ValidatorMessages{
		"novel_id.required": "书籍ID不能为空",
		"name.required":     "章节名字不能为空",
		"content.required":  "章节内容不能为空",
	}
}

// 获取章节列表
type GetChapterList struct {
	NovelId string `form:"novel_id" json:"novel_id" binding:"required"`
}

func (g GetChapterList) GetMessages() ValidatorMessages {
	return ValidatorMessages{
		"book_id.required": "书籍id不能为空",
	}
}

// 获取章节详情
type GetChapterDetail struct {
	ID string `form:"id" json:"id" binding:"required"`
}

func (g GetChapterDetail) GetMessages() ValidatorMessages {
	return ValidatorMessages{
		"book_id.required": "章节id不能为空",
	}
}
